package main

import (
	"fmt"
	"reflect"
)

var defaultPrice int = 10

func printPriceWithSwitch(weather string) {
	switch weather {
	case "sunny":
		defaultPrice = 10
		fmt.Println("It's sunny")
		fmt.Println("The price is", defaultPrice)
	case "rainy":
		defaultPrice = 100
		fmt.Println("It's not sunny")
		fmt.Println("The price is", defaultPrice)
		//匹配任意其中的一个
	case "cloufy", "foggy":
		defaultPrice = 500
		fmt.Println("It's cloufy or foggy")
		fmt.Println("The price is", defaultPrice)
	default:
		fmt.Println("It's cloudy")
	}
}
func main() {
	//switch
	//switch 表达式 {case 表达式1: 代码块1 case 表达式2: 代码块2 default: 代码块}
	weather := "sunny"
	printPriceWithSwitch(weather)
	weather = "rainy"
	printPriceWithSwitch(weather)
	weather = "xxx"
	printPriceWithSwitch(weather)
	weather = "cloufy"
	printPriceWithSwitch(weather)
	weather = "foggy"
	printPriceWithSwitch(weather)
	fmt.Println(reflect.TypeOf(defaultPrice))
}
